# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=libbf
pkgver=2020.01.19
_ver=${pkgver//./-}
pkgrel=1
pkgdesc="A small library to handle arbitrary precision floating point numbers"
arch=('loong64' 'x86_64')
url="https://bellard.org/libbf/"
license=('MIT')
depends=('mpfr')
source=("https://bellard.org/libbf/libbf-$_ver.tar.gz")
sha512sums=('3369429f6206ecf7d3ac4e664ad356eff44aab4779ca5827ec0a8c0dec392f457241e0ebe4ae1efe5e46f1e67661065d2b6b38da0a809d27986b402da44bf8e9')

build() {
  cd $pkgname-$_ver
  CC="gcc -Wall $CFLAGS $LDFLAGS -DCONFIG_MPFR"
  $CC -c -fPIC libbf.c cutils.c
  $CC -shared -o libbf.so libbf.o cutils.o
  $CC -o bfbench bfbench.c -L. -lbf -lm -lmpfr -lgmp
  $CC -o tinypi tinypi.c -L. -lbf -lm -lmpfr -lgmp
}

package() {
  cd $pkgname-$_ver
  install -Dm755 libbf.so -t "$pkgdir"/usr/lib/
  install -Dm644 libbf.h -t "$pkgdir"/usr/include/
  install -Dm755 tinypi bfbench -t "$pkgdir"/usr/bin/
}
# vim:set ts=2 sw=2 et:
